<template>
    <!-- 图片展示组件封装 -->
    <div class="cover" :style="{ width: width + 'px', height: width + 'px' }">
        <el-image :style="{ width: width + 'px', height: width + 'px' }" fit="scale-down" loading="lazy"
            :src="cover ? proxy.globalInfo.imageUrl + cover : localCover">
        </el-image>
    </div>
</template>

<script setup>
import { ref, getCurrentInstance } from 'vue'
const { proxy } = getCurrentInstance()

// 默认展示封面
const localCover = new URL("@/assets/logo.svg", import.meta.url).href;
const props = defineProps({
    cover: {
        type: String,
    },
    width: {
        type: Number,
        default: 60
    }
})
</script>

<style lang="scss">
.cover {
    background-color: #ddd;
    border-radius: 5px;
    overflow: hidden;
}
</style>